import 'package:flutter/material.dart';
import '../../common/select_templet_boss.dart';

class Test15 extends StatefulWidget{
    _TestState createState() => _TestState();
}

class _TestState extends State<Test15> {

    List gradeList = [{"value":"111","label":"111"},
                        {"value":"222","label":"222"},
                        {"value":"333","label":"333"},
                        {"value":"444","label":"444"}];
    List subjectList = [{"value":"333","label":"333"},
                        {"value":"444","label":"444"}];
    var selectContent;
    List selectValList = [];
    Function allCallBack;

    @override
    void initState() {
        selectContent = [
                SelContentModel(
                    title:"年级筛选",
                    selectVL: gradeList,
                    callback: (value){
                        print("----小1callback:-------${value}");
                        setState(() {
                            subjectList.add({"value":"555","label":"555"});
                        });
                    }
                ),
                SelContentModel(
                    title:"科目筛选",
                    selectVL: subjectList,
                    callback: (value){
                        print("----小1callback:-------${value}");
                    }
                ),
        ];
        selectValList = ["111","333"];
        allCallBack = (value){
            print("----大callback:------${value}");
            setState(() {
                selectValList = value;
            });
        };
        super.initState();
    }

    @override
    Widget build(BuildContext context) {
        return Stack(
            children: <Widget>[
                Scaffold(
                    appBar: AppBar(
                        title: Text("仿boss筛选模板"),
                        centerTitle: true,
                        actions: <Widget>[
                            IconButton(
                                icon: Icon(IconData(0xe622, fontFamily: "Iconfont")),
                                onPressed: (){
                                    Navigator.push(context,MaterialPageRoute(builder: (context) => SelTemp(content: selectContent,callback: allCallBack,selValList:selectValList)),);
                                },
                            )
                        ],
                    ),
                    body: Container(
                        child: Text("点击筛选展开筛选菜单")
                    )
                    
                ),
                // popSel(),
            ],
        );
    }

    // Widget popSel(){
    //     return SelTemp(
    //         content: selectContent,
    //         callback: allCallBack
    //     );
    // }


}
